
<include file="Flat:header" />
<style media="screen">
.activity {
    min-height: 250px;
    border: 1px solid #1ABC9C;
    border-top-width: 8px;
    border-radius: 4px;
    padding: 5px;
    margin: 0 0 15px;
    background: #fff;
    box-shadow: 0 2px 2px rgba(82, 82, 82, 0.15);
    font-size: 14px;
}

.activity.not {
    border-color: #BDC3C7;
}

.activity.end {
    border-color: #BDC3C7;
}

.activity.now {
    border-color: #024ea1;
}

.activity.sign {}
.activity.sign .btn {
    background: #1ABC9C;
}

.activity.img {
    border-color: #024ea1;
    text-align: center;
}

.activity .title {
    position: relative;
    text-align: center;
    font-size: 15px;
    padding: 10px 0 15px 0;
    min-height: 73px;
}
.activity .title span {
    position: relative;
    z-index: 2;
}
.activity .title i {
    position: absolute;
    right: 3px;
    top: -5px;
    font-size: 72px;
    color: rgba(26, 188, 156, .3);
    color: ##64ffe0;
    z-index: 1;
}

.activity .time {
    font-size: 13px;
}
.activity .status {
    text-align: right;
    font-size: 13px;
}
.activity .btn-container {
    padding: 10px 0;
    text-align: center;
}
.activity .btn-container .btn {
    width: 95%;
    font-size: 12px;
}
.activity .btn-container.detail {

}
.activity .btn-container.info {
    display: none;
}
.activity.sign .btn-container.info {
    display: block;
}
.activity.end .btn-container.info {
    display: block;
}


.activity .btn-container.checkin {

}
.activity.sign .btn-container.checkin {
    display: none;
}

#is-zhaosheng.now .detail,
#is-zhaosheng.now .print,
#is-zhaosheng.now .mian-tan {
    display: none;
}

.btn-sm, .btn-group-sm>.btn {
    padding-left: 0;
    padding-right: 0;
    text-align: center;
}
.none{display:none;}
</style>

<body>
<div class="container-fluid">
    <div class="row">
        <div class="col-xs-12 pln prn">

			<include file="Flat:top-nav" />
        </div>
        <div class="col-xs-3 col-sm-3 col-md-2 hidden-xs" style="margin-left: -15px;">

			<include file="Flat:side-nav" />
        </div>
        <div class="col-xs-12 col-sm-9 col-md-10">
            <div class="activity-list row fixed-block">


					<?php foreach($acList as $key=>$oneAc){ ?>
                    <div class="col-xs-12">
                        <div class="row">
                            <!--  报名本年 --->
                            <div class="col-xs-12 col-sm-12 col-md-6" <?php if($studentInfo['add_type']==2){ echo 'style="display:none;"';} ?> >
            					<div class="row activity activity{$key + 1}">
            						<div class="title col-xs-12">
            							<span>{$oneAc['title']}</span>
                                        <i class="fui-check-circle <?php echo $status=='sign' ? '' : 'hide' ; ?>"></i>
            						</div>
                                    <p style="font-size:14px;text-align:center">{$oneAc['tip2']}</p>
            						<div class="time col-xs-7">
            							时间:<br><?php echo date("Y年m月d日",$oneAc['date_start']); ?> 至<br><?php echo date("Y年m月d日",$oneAc['date_end']); ?>
            						</div>
            						<div class="status col-xs-5">
            							<br><br>状态:
            							<span class="none" <?php if($oneAc['status']==0){  echo 'style="display:inline-block"'; } ?> >进行中</span>
            							<span class="none" <?php if($oneAc['status']==3){  echo 'style="display:inline-block"'; } ?> >已结束</span>

            						</div>
									
            						<div class="btn-container detail col-xs-6">
            							<a href="__APP__/StudentApi/text/type/activity/acid/{$oneAc['activity_id']}" class="btn btn-sm btn-info" <?php if($actInfo['status']==3){ echo 'style="display:none"'; } ?>  ><?php echo $studentInfo['name']==''? '马上报名':'活动详情'; ?></a>
            							<a  class="btn btn-sm btn-info" disabled <?php if($actInfo['status']!=3){ echo 'style="display:none"'; } ?> >已结束</a>
            						</div>
									<?php
										if(!$oneAc['is_score']==1){
									?>
									
            						<div class="btn-container detail col-xs-6" <?php if($studentInfo['name']==''){ echo 'style="display:none;"';} ?>  >
            							<a href="__APP__/StudentApi/reg/add_type/1/acid/{$oneAc['activity_id']}" class="btn btn-sm btn-info">填写&修改报名信息</a>
            						</div>
									<?php  }else{ ?>
									<?php //print_r($actInfo); ?>
									
            						<div class="btn-container detail col-xs-6" <?php if( ($actInfo['is_score']==1||empty($actInfo))&& ( $studentInfo['mt_res']!='已录取'||$studentInfo['name']=='' ) ){   echo 'style="display:none;"'; } ?> >
            							<a href="__APP__/StudentApi/reg/add_type/4/acid/{$oneAc['activity_id']}" class="btn btn-sm btn-info">完善注册信息</a>
            						</div>
									<?php  } ?>
                                </div>
                            </div>
        					<!--  流程图 --->
                            <div class="col-xs-12 col-sm-12 col-md-6">
            					<div class="row activity">
            						<img style="width: 100%;" src="{$oneAc['thumb']}"  />
            					</div>
                            </div>
                        </div>
                    </div>

					<!--  报名次年 --->
                    <div class="col-xs-12 col-sm-12 col-md-6"  <?php if($studentInfo['add_type']==1){ echo 'style="display:none;"';} ?> >
    					<div  class="row activity activity0" style="border-color:red">
    						<div class="title col-xs-12">
    							<span>{$oneAc['title2']}</span>
                                <i class="fui-check-circle <?php echo $status=='sign' ? '' : 'hide' ; ?>"></i>
    						</div>
							<!--
    						<div class="time col-xs-7">
    							时间:<br><?php echo date("Y年m月d日",$oneAc['date_start']); ?> 至<br><?php echo date("Y年m月d日",$oneAc['date_end']); ?>
    						</div>
							-->
    						<div class="status col-xs-5" style="text-align:right">
    							<br><br>状态:
    							<span class="none" <?php if($oneAc['status']==0){  echo 'style="display:inline-block"'; } ?> >进行中</span>
    							<span class="none"  <?php if($oneAc['status']==3){  echo 'style="display:inline-block"'; } ?> ></span>

    						</div>
    						<div class="btn-container detail col-xs-6 col-xs-offset-3">
        							<a href="javascript:;" class="btn btn-sm btn-info" onclick="
                                    $.confirm({
                                        text: '预登记报名范围为2019年9月以后学年，是否需要继续？',
                                        onOK: function () {
                                            window.location.href = '__APP__/StudentApi/reg/add_type/2/acid/{$oneAc['activity_id']}';
                                        },
                                        onCancel: function() {

                                        }
                                    });
                                    ">预登记</a>
    						</div>

                        </div>
                    </div>
					<?php }  ?>
				</div>

            </div>
        </div>
    </div>


</div>
</body>
<include file="Flat:footer" />
<script>
    // $('.activity.now .checkin .btn').removeAttr('disabled');

    $.post(parameter.userInfoGet, {add_phone: getCookie('user')}, function(data) {
        $('.activity.now .checkin .btn').removeClass('disabled');
        var json = JSON.parse(data);
        if (json.is_confirm == 1) {
            $('#is-zhaosheng .edit-message').addClass('disabled').on('click', function() {
                return false;
            });
        }

        if (json.volunteer != 0) {
            var detailHref = $('#is-zhaosheng .detail a').attr('href');
            $('#is-zhaosheng .detail a').attr('href', detailHref + '/volunteer/' + json.volunteer);

            var infoHerf = $('#is-zhaosheng .info a').attr('href');
            $('#is-zhaosheng .info a').attr('href', infoHerf + '/volunteer/' + json.volunteer);

        }

        // 已经报名的活动显示相应的标示
        if (json.name != '' && json.name != undefined) {
            // 已报名
            if (json.add_type == 1) {
                $('.activity1').find('.title .fui-check-circle').removeClass('hide');
                $('.activity1').find('.status span')[0].innerHTML += '(已报名)';
                $('.activity1').find('.status span')[1].innerHTML += '(已报名)';
            } else {
                $('.activity0').find('.title .fui-check-circle').removeClass('hide');
                $('.activity0').find('.status span')[0].innerHTML += '(已报名)';
                $('.activity0').find('.status span')[1].innerHTML += '(已报名)';
            }
        } else {
            // 未报名
            $('.activity1').find('.detail').addClass('col-xs-offset-3');
        }


        // 面谈凭证
        $('#mian-tan').on('click', function() {
            if (json.fenzu == '') {
                alert('请亲临德胜学校现场领取面谈凭证，并提交报名表和2张大一寸照片。时间：5月5-15日 9:00-17:00（中午、节假日均受理）。');
                return;
            }
            // if (json.fenzu == '') {
            //     alert('请携带报名表格，\n到校领取面谈凭证');
            //     return;
            // }
            window.open(parameter.pingzheng + json.student_id + '.html');
        });
        // 打印报名表
        $('#print').on('click', function() {
            if (isWeixin()) {
                // $.alert("手机版微信请在到电脑端浏览器打开网址重新登录打印。<br>网址：http://bm.desheng-school.cn", "提示");
                var r = confirm('手机版微信请在学校网站首页报名通道重新登录进行打印。\n电脑版微信请点击OK，继续打印。\n网址：http://bm.desheng-school.cn');
                if (r) {
                    window.open(parameter.printBaoming + json.student_id + '.html');
                }
                // return;
            } else {
                window.open(parameter.printBaoming + json.student_id + '.html');
            }
            // window.open(parameter.printBaoming + json.student_id + '.html');

            // var r = confirm('确认并打印报名表？(请认真核实您的资料，一旦打印，将无法修改)');
            // if (r) {
            //     window.open(parameter.printBaoming + json.student_id + '.html');
            // }
        });
    });

    // 获取活动列表
    // status 0-可以报名 1-不显示 2-未开放
    // is_baoming 0-未报名 1-已报名
    function getActivityList(studentId,type) {
        $.post(parameter.getActivityList, {'student_id': studentId}, function(data) {
            var arrActivity = JSON.parse(data);
            var html = '';
            for (var i in arrActivity) {
				var type="<?php echo $_REQUEST['type']; ?>";
                switch (type) {
                    case 'isbaoming':
                        if (arrActivity[i].is_baoming != 1) {
                            continue;
                        }
                        break;
                    case 'isscore':
                        if (arrActivity[i].is_baoming != 1) {
                            continue;
                        }
                        var isScore = true;
                        break;
                }
                switch (arrActivity[i].status) {
                    case 0:
                        if (arrActivity[i].is_baoming == 0) {
                            var status = 'now';
                            var statusText = '可报名';
                        } else if (arrActivity[i].is_baoming == 1) {
                            var status = 'sign';
                            var statusText = '已报名';
                        }
                        break;
                    case 1:
                        continue;
                        break;
                    case 2:
                        var status = 'not';
                        var statusText = '未开放';
                        break;
                }
                var startTime = (new Date(arrActivity[i].date_start * 1000)).format('yyyy-MM-dd');
                var endTime = (new Date(arrActivity[i].date_end * 1000)).format('yyyy-MM-dd');
                html += '\
                    <div class="col-xs-12 col-sm-6 col-md-4">\
                        <div class="row activity ' + status + '">\
                            <div class="title col-xs-12">\
                                ' + arrActivity[i].title + '\
                            </div>\
                            <div class="time col-xs-6">\
                                ' + startTime + '<br>' + endTime + '\
                            </div>\
                            <div class="status col-xs-6">\
                                <br>状态:<span>' + statusText + '</span>\
                            </div>\
                            <div class="btn-container detail col-xs-6">\
                                <a href="__APP__/StudentApi/text/type/activity/acid/' + arrActivity[i].activity_id + '" class="btn btn-sm btn-info">活动详情</a>\
                            </div>\
                            <div class="btn-container info col-xs-6 ' + (isScore ? 'hide' : '') + '">\
                                <a href="__APP__/StudentApi/reg/type/activity/acid/' + arrActivity[i].activity_id + '" class="btn btn-sm btn-info">修改信息</a>\
                            </div>\
                            <div class="btn-container info col-xs-6 ' + (isScore ? '' : 'hide') + '">\
                                <a href="./text" class="btn btn-sm btn-info">查看成绩</a>\
                            </div>\
                            <div class="btn-container checkin col-xs-6">\
                                <a href="__APP__/StudentApi/reg/type/activity/acid/' + arrActivity[i].activity_id + '" class="btn btn-sm btn-info" ' + (status == 'not' ? 'disabled' : '') + '>我要报名</a>\
                            </div>\
                        </div>\
                    </div>\
                ';


            }
            $('.activity-list').append(html);
        });
    }

</script>
